home *** CD-ROM | disk | FTP | other *** search
/ .net 2002 March / DotNetMagazine-Issue107-Coverdisc-NET107-02-03-PCMac.bin / pc / PC Software / free_browsing / DavesQckSearchDbar3-14 / dqsd.exe / searches / shack.xml < prev    next >
Text File  |  2002-09-24  |  4KB  |  119 lines

  1. <search function="shack">
  2.   <name>Shacknews.com Comments</name>
  3.   <description>
  4.     Search the shacknews.com comments database
  5.     <div class="helpboxDescLabels">Switches:</div>
  6.     <table class="helpboxDescTable">
  7.       <tr><td>/user:username</td><td> - </td><td>Narrow search to username. Replace blanks in username with + (fex: Steve Gibson becomes Steve+Gibson)</td></tr>
  8.       <tr><td>/db:database</td><td> - </td><td>Database to use. Default is current, possible values: current, archive1</td></tr>
  9.       <tr><td>/type:type</td><td> - </td><td>Narrow search to post type. Default is all, possible values: all, i (informative), n (NWS)</td></tr>
  10.       <tr><td>/sortby:key</td><td> - </td><td>Sort results by key. Default is date, possible values: date, relevance</td></tr>
  11.     </table>
  12.     <div class="helpboxDescLabels">Examples:</div>
  13.     <table class="helpboxDescTable">
  14.       <tr><td>shack 1942 /type:i </td></tr>
  15.       <tr><td>shack Doom3 /type:all</td></tr>
  16.       <tr><td>shack poop /user:Steve+Gibson</td></tr>
  17.     </table>
  18.  
  19.   </description>
  20.   <category>Other</category>
  21.   <link>http://www.shacknews.com/</link>
  22.   <contributor>Wolfgang Deutsch</contributor>
  23.   <email>wolfgang.deutsch@chello.at</email>
  24.    
  25.   <script><![CDATA[
  26.  
  27.     // Default switches. Change as desired
  28.  
  29.     var defaultQuery="";
  30.     var defaultUser="";
  31.     var defaultDb="current";
  32.     var defaultType="all";
  33.     var defaultSort="date";
  34.  
  35.     // Possible values for switches
  36.     var switchValues = [];
  37.  
  38.     switchValues["db"] = "current archive1";
  39.     switchValues["type"] = "all i n";
  40.     switchValues["sortby"] = "relevance date";
  41.  
  42.     function shack(q)
  43.     {
  44.       if (nullArgs("shack", q))
  45.         return false;
  46.  
  47.       var params = [];
  48.  
  49.       params["query"] =  new Array("query=", defaultQuery);
  50.       params["user"] =   new Array("&user=", defaultUser);
  51.       params["db"] =     new Array("&db=", defaultDb);
  52.       params["type"] =   new Array("&type=", defaultType);
  53.       params["sortby"] = new Array("&sortby=", defaultSort);
  54.  
  55.       var args = parseArgs(q, "user, db, type, sortby");
  56.  
  57.       var url = "http://www.shacknews.com/jazz/search.x?";
  58.  
  59.       for (var i = 0; i < args.switches.length; i++)
  60.       {
  61.  
  62.         var sw = args.switches[i];
  63.         switch (sw.name)
  64.         {
  65.           case "user":
  66.             if( sw.value == "" )
  67.             {
  68.               nullArgs("shack","?");
  69.               return false;
  70.             }
  71.             else
  72.             { 
  73.               params["user"][1] = sw.value;
  74.             }
  75.             break;
  76.  
  77.           default:
  78.             if (sw.value=="" || switchValues[sw.name].indexOf(sw.value)==-1)
  79.             {
  80.               nullArgs("shack","?");
  81.               return false;
  82.             }
  83.             else
  84.             { 
  85.               params[sw.name][1] = sw.value;
  86.             }
  87.             break;
  88.         }
  89.       }
  90.  
  91.       if (args.switches.length == 0)
  92.       {
  93.         params["query"][1] = q;
  94.       }
  95.       else
  96.       {
  97.         params["query"][1] += args.q;
  98.       }
  99.  
  100.       url += params["query"].join('');
  101.       url += params["user"].join('');
  102.       url += params["db"].join('');
  103.       url += params["type"].join('');
  104.       url += params["sortby"].join('');
  105.  
  106.       openSearchWindow(url);
  107.  
  108.  
  109.     }
  110.   ]]></script>
  111.  
  112.   <copyright>
  113.   Copyright (c) 2002 David Bau
  114.   Distributed under the terms of the
  115.   GNU Public License, Version 2 (http://www.gnu.org/copyleft/gpl.txt)
  116.   </copyright>
  117. </search>
  118.  
  119.